package cate.game.play.skill.active;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;

/**
 * 最后一击时若目标生命值小于30%，则直接处决，不超过攻击力的10倍
 */
public class 蚩尤魔决AH extends ActiveHandler{

	private int 血量;

	private double 攻击力系数;

	//血量=3000&攻击力系数=50000&
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		血量 = args.getInt("血量", 0);
		攻击力系数 = args.getWDouble("攻击力系数", 0d);
	}


	@Override
	public void beforeSingleEffect(SkillActionCtx action, SkillEffect effect, Fighter target) {
		if (target.attr.hpCur() > skill.owner.attr.attTotal() * 攻击力系数) {
			return;
		}
		if (target.attr.total().hpCurRate() > 血量) {
			return;
		}
		target.attr.kill(action, skill.owner);
	}
}
